﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace DVK.SP2007
{
    /// <summary>
    /// Dvk specific exception, which does additional logging when thrown.
    /// </summary>
    public class DvkException : Exception, ISerializable
    {
        public DvkException() : this(string.Empty, null) { }
        public DvkException(string message) : this(message, null) { }
        public DvkException(string message, Exception exc) : base(message, exc) 
        {
            Logger.Instance.LogError(LoggerEvents.DvkExceptionOccured, exc, message); 
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DvkException"/> class.
        /// </summary>
        /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
        /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// The <paramref name="info"/> parameter is null.
        /// </exception>
        /// <exception cref="T:System.Runtime.Serialization.SerializationException">
        /// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
        /// </exception>
        protected DvkException(SerializationInfo info, StreamingContext context) : base(info, context) { }
    }
}
